const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
  // for files that should be compiled for electron main process
  transpileDependencies: true,
  devServer: {
    port: 8081,
    proxy: {
      "/api": {
        // target: "http://192.168.8.23:7070/",
        // target: "http://192.168.8.30:8080/",
        target: "http://127.0.0.1:8080/",
        changeOrigin: true,
        pathRewrite: {
          "/api": "",
        },
        // onProxyRes(proxyRes, req, res) {
        //   // 请求头输出x-real-url2
        //   const realUrl =
        //     new URL(req.url || "", "http://192.168.8.30:8080")?.href || "";
        //   // new URL(req.url || "", "http://192.168.8.23:7070/")?.href || "";
        //   proxyRes.headers["x-real-url2"] = realUrl;
        // },
      },
    },
  },
});
